var external0 = null;
var external_10001 = null;

String.prototype.format = function() {  
    if(arguments.length == 0) return this;  
    var obj = arguments[0];  
    var s = this;  
    for(var key in obj) {  
        s = s.replace(new RegExp("{{" + key + "}}", "g"), obj[key]);  
    }  
	return s;
	// 传过来的是个键值对
	// 	(MSG: "hello")
	// 可以把{{MSG}}直接替换为"hello"
}  

new QWebChannel(qt.webChannelTransport,
	function (channel) {
		// 使用网络通道里面注册好的对象
		external0 = channel.objects.external0;
		external_10001 = channel.objects.external_10001;
	}
);

function appendHtml0(msg){
	$("#placeholder").append(external0.msgRHtmlTmpl.format(msg));
	window.scrollTo(0,document.body.scrollHeight); ;  
};

function recvHtml_10001(msg){
	$("#placeholder").append(external_10001.msgLHtmlTmpl.format(msg));
	window.scrollTo(0,document.body.scrollHeight); ;  
};
